# Contributor: Thomas Boerger <thomas@webhippie.de>
# Maintainer: Thomas Boerger <thomas@webhippie.de>
pkgname=hugo
pkgver=0.74.3
pkgrel=0
pkgdesc="Fast and flexible static site generator written in Go"
url="https://gohugo.io/"
arch="all !x86 !s390x !mips !mips64" # tests fail on x86 and s390x; limited by go on mips
license="Apache-2.0"
makedepends="go"
subpackages="$pkgname-doc $pkgname-bash-completion"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/gohugoio/hugo/archive/v$pkgver.tar.gz
	0001-Remove-git-tests.patch
	0002-skip-tests-that-need-nodejs.patch
	"

build() {
	go build -v -o bin/$pkgname --tags extended
	./bin/hugo gen man
	./bin/hugo gen autocomplete --completionfile="$builddir"/hugo.bash
}

check() {
	# image_test.so:548 fails
	case "$CARCH" in
		aarch64|ppc64le) return 0 ;;
	esac
	go test ./...
}

package() {
	install -Dm755 "$builddir"/bin/$pkgname "$pkgdir"/usr/bin/$pkgname
	install -Dm644 "$builddir"/man/*.1 -t "$pkgdir"/usr/share/man/man1
	install -Dm644 "$builddir"/hugo.bash \
		"$pkgdir"/usr/share/bash-completion/completions/hugo
}

sha512sums="aca42db5abe1bf36c6793f3e6cf260167285f074366c03fc8f2000f59e4860c634a65fa14855f03dc2c4513fb83f2c215e590825e6d037d107825d589f08208f  hugo-0.74.3.tar.gz
57be9a6c8e49bd2a75921d51d8dc503439f68453a6c9803c9cecef8bb63541f10d8b652db151426949c1bcf134a96eec0253ee4a61c0987143d6159ea49e9588  0001-Remove-git-tests.patch
b1c2609a546869e5b1d9ada2eeb268c8f2d61f8838cd47ee80a24a6d9bb9d07e3652e3d8ef836a5e635ec295d27e2842c44ae2a0136560ba207f945e366162fc  0002-skip-tests-that-need-nodejs.patch"
